<?php $this->display("objects/breadcrumbs") ?>

<h2><?php _e($object['title']) ?></h2>
<p id="objdesc"><strong><?php _e($object['description']) ?></strong></p>

<?php $this->append ("scripts", "discussiontag") ?>

<script type="text/javascript">
var tagObjectId = '<?php echo $object['object_id'] ?>';
var tagURL = '<?php echo Gene::makeLink($parent) ?>/view/tag/';
var userTagURL = '<?php echo Gene::makeLink($parent) ?>/view/tag/~<?php _e($member['name']) ?>/';
</script>

<p id="populartags" class="tagcloud"><strong>Popular Tags:</strong>
<?php if (count($tags)): ?>
	<?php foreach ($tags as $i): ?>
	<a href="<?php echo Gene::makeLink($parent) ?>/view/tag/<?php echo str_replace (" ", "_", $i) ?>"><?php _e($i) ?></a> 
<?php endforeach; ?> |<?php endif; ?> <a id="showpublictags" href="#" onclick="javascript:return showPublicTags(<?php echo $object['object_id'] ?>);">Show All</a></p>

<p id="mytags" class="tagcloud"><strong>My Tags:</strong> <span id="quicktag">
<?php if (count($usertags)): ?>
	<?php foreach ($usertags as $i): ?>
		<a href="<?php echo Gene::makeLink($parent) ?>/view/tag/~<?php _e($member['name']) ?>/<?php _e($i) ?>"><?php _e($i) ?></a> 
	<?php endforeach; ?>
	
	<?php if (checkPermission($object, "write")): ?>
		( <a href="#" onclick="javascript:return quickTag();">Edit Tags</a> )
	<?php endif; ?>
<?php else: ?>
	<em>You have not tagged this discussion.</em>
	
	<?php if (checkPermission($object, "write")): ?>
		<a href="#" onclick="javascript:return quickTag();">Tag this discussion</a>.
	<?php endif; ?>
<?php endif; ?>
</span></p>

<?php if ($extra['readonly']): ?>
	<p class="errormessage">This discussion is locked; you will not be able to add or modify it.</p>
<?php endif; ?>

<?php $this->display("objects/discussioncomment/embed", array("object" => $object)); ?>

<div id="comments">

<?php echo getPager(array(
	"object" => $object,
	"numpages" => $numpages,
	"currentpage" => $pagenum,
	"anchor" => "comments",
	"location" => "top"
)) ?>

<?php if (count($childs)): ?>
	<?php foreach ($childs as $i): ?>
		<?php if (checkPermission($i, "view")): ?>
			<?php $this->display("objects/discussioncomment/embed", array("object" => $i, "parent" => $object)); ?>
		<?php endif; ?>
	<?php endforeach; ?>
<?php else: ?>
	<p><em>There are no comments in this discussion yet... Why not be the first?</em></p>
<?php endif; ?>

<?php echo getPager(array(
	"object" => $object,
	"numpages" => $numpages,
	"currentpage" => $pagenum,
	"anchor" => "comments",
)) ?>

</div>

<?php if (checkPermission($object, "write")): ?>
	<?php $this->display("objects/discussioncomment/create"); ?>
<?php endif; ?>